package com.mallcloud.mall.common.core.constant.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * Redisson key生成
 */
@Getter
@AllArgsConstructor
public enum RLockEnum {

	POINT_GOODS_REDEEM("RLOCK:POINT_GOODS_REDEEM:%s", "积分商品兑换"),
	VALUE_CARD_PURCHASE("RLOCK:VALUE_CARD_PURCHASE:%s", "储值卡购买"),
	VALUE_CARD_RECHARGE("RLOCK:VALUE_CARD_RECHARGE:%s", "储值卡充值"),
	VALUE_CARD_BIND("RLOCK:VALUE_CARD_BIND:%s", "储值卡绑定"),
	VALUE_CARD_GIVEN("RLOCK:VALUE_CARD_GIVEN:%s", "储值卡转赠"),
	COUPON_GIVEN("RLOCK:COUPON_GIVEN:%s", "券转赠"),
	XGL_PARKING_REDEEM_RECORD_REPORTING("RLOCK:XGL_PARKING_REDEEM_RECORD_REPORTING:%s", "星光里停车券兑换并上传记录"),
	XGL_QRCODE_PAYMENT_NOTIFY("RLOCK:XGL_QRCODE_PAYMENT_NOTIFY:%s", "星光里扫码支付回调"),
	WXPAY2("RLOCK:WXPAY2", "微信支付2通知"),
	WXPAY3("RLOCK:WXPAY3", "微信支付3通知"),
	WXPAY3_REFUND("RLOCK:WXPAY3_REFUND", "微信支付3退款通知"),
	MM_ORDER_TIMEOUT("RLOCK:MM_ORDER_TIMEOUT:%s", "美美停车订单过期key"),
	;

	private String keyFormat;
	private String description;

	/**
	 * 获取key
	 *
	 * @param bizCode 业务code
	 * @return
	 */
	public String getKey(Object bizCode) {
		return String.format(this.getKeyFormat(), bizCode);
	}
}
